package cc.telecomdigital.tdstock.activity.groups.more;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import cc.telecomdigital.tdstock.R;
import cc.telecomdigital.tdstock.Framework.UniqueItem.TDStockLog;
import cc.telecomdigital.tdstock.Tools.ActivityGroupController;
import cc.telecomdigital.tdstock.activity.BaseActivity;
import cc.telecomdigital.tdstock.activity.groups.MoreGroup;

public class TrafficDetailsActivity extends BaseActivity
{

	public static final String	PARAMS_KEY_TITLE	= "title";
	public static final String	PARAMS_KEY_CONTENT	= "content";

	//public static final String TRAFFIC_URL = "http://%s/iphone/traffic/itf.do?";

	private static final String	TAG				= TrafficDetailsActivity.class
													.getSimpleName();

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);

		setContentView(R.layout.traffic_details);

		Intent intent = getIntent();

		String title = intent.getStringExtra(PARAMS_KEY_TITLE);

		String content = intent.getStringExtra(PARAMS_KEY_CONTENT);

		TextView titleView = (TextView) findViewById(R.id.title);

		titleView.setText(title);

		if (content != null)
		{

			TextView contentView = (TextView) findViewById(R.id.content);

			contentView.setText(content);
		}

		Button _toolBtnReturn = (Button) findViewById(R.id.more_returnbtn);

		_toolBtnReturn.setOnClickListener(new OnClickListener()
		{
			@Override
			public void onClick(View v)
			{
				TDStockLog.d(TAG, "close current activity and forwarding to the previous");

				Intent intent = new Intent(getApplicationContext(),
						TrafficActivity.class);
				intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP| Intent.FLAG_ACTIVITY_NO_USER_ACTION);
				
				SwitchForwardActivity(TrafficActivity.class, intent);

			}

		});

	}
	
	@Override
	public ActivityGroupController GetActivityGroupController()
	{
		return MoreGroup.GetActivityGroupHostControl();
	}
	
	

}